#ifndef _OBJECT_HPP_
#define _OBJECT_HPP_

#include "../utils/Vector3D.hpp"
#include "../general/PhysicsManager.hpp"
#include "../utils/Numerics.hpp"
#include "../general/Integrator.hpp"
#include "../general/Box3D.hpp"

#include <list>
using namespace std;

namespace klasPhysics
{

class PhysicsManager;
class Integrator;

class Object
{
friend class PhysicsManager;

protected:
	list<Object*> m_CollidingWith;	// Each object needs to maintain of list of other objects that it is colliding with
	ForceList m_Forces; // A list of forces that will be applied to the object during the integration phase

	Box3D m_FastCollisionBox;

	State m_State;	// The state of the object

	void Integrate(Real totalTime, Real timeStep);			// Integrates the object's applied forces to the object and also updates the location
	void FastCollisionTest(Object *other);  // Performs a fast collision test with the object.  If the object is colliding, then it is added to the list m_ColldingWith
	virtual void NormalCollisionTest() = 0; // Performs a more sophistaced collision test and adds necessary forces to m_AppliedForces on this object only.

public:
	inline void SetMass(Real mass);
	inline void SetLocation(const Vector3D &loc);
	inline void SetRotation(const Vector3D &axis, Real radians);
	void AddForce(const Vector3D &force);
	inline Vector3D& GetLocation() {return m_State.location;}

	// ctor and dtor
	Object() {m_State.mass = 1; m_State.inverseMass = 1;}
	virtual ~Object() {}
};

}

#endif // _OBJECT_HPP_
